home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_boatmover.cog < prev    next >
Text File  |  1999-11-15  |  11KB  |  424 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_Boatmover.cog
  4. #
  5. # This cog will release the keyboat from it's piers.
  6. #
  7. # [CM]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14. #............MESSAGES..........
  15. message    startup
  16. message    activated
  17. message    arrived
  18. message    pulse
  19. message    entered
  20. message    timer
  21.  
  22. #............ACTORS..........
  23.  
  24. thing    indy
  25. thing    player                                        local
  26.             
  27. thing    shark1                                        
  28. thing    shark2                                        
  29. #............CAMERAS..........                      
  30. thing    cam1                                        
  31. thing    cam2                                        
  32. thing    curCam                                        local
  33.  
  34. thing    sharkCam                                    
  35.             
  36. #............COGS...................
  37. cog        SharkWaycog
  38.  
  39. #............CAMERA TARGETS..........               
  40. thing    indytarget                                    local
  41.  
  42. thing    sharkCamtarget                                
  43.  
  44.  
  45. #............COGS..........
  46. cog        hintcog
  47.  
  48. #............PROPS..........
  49. thing    boat
  50. thing    piers
  51. thing    switch
  52. thing    door
  53.  
  54. thing    key
  55. thing    theKing
  56. thing    doc
  57.  
  58. thing    shark_bars
  59.  
  60.  
  61. #............FXEVENTSPOTS..........
  62. thing    boatring                                    local
  63. thing    pierring1                                    local
  64. thing    pierring2                                    local
  65. thing    pierring3                                    local
  66. thing    pierring4                                    local
  67.  
  68. thing    pierring1pos
  69. thing    pierring2pos
  70. thing    pierring3pos
  71. thing    pierring4pos
  72.  
  73. thing    boatringpos
  74.  
  75. surface    doorfloorSURF
  76.  
  77.  
  78. #............AIEVENTSPOTS..........
  79. thing    sharkgenpos1
  80. thing    sharkgenpos2
  81. thing    scorp1
  82. thing    scorp2
  83.  
  84. thing    scorp1_mv0
  85. thing    scorp2_mv0
  86.  
  87. thing    scorplooktarget
  88.  
  89. #............TRIGGERS...........
  90. sector    exit_sect
  91.  
  92. #............VARIABLES..........
  93.  
  94. int        keysaid=0                                    local
  95. int        released=0                                    local
  96. int        soundrun                                    local
  97. int        index                                        local
  98. int        doorloop                                    local
  99. int        music                                        local
  100. int        i                                            local
  101. flex    animId                                        local
  102. flex    t_shark00                                   local
  103. flex    t_shark01                                   local
  104. int        TIMERID_RIPPLES=1                            local
  105.  
  106. #............VECTORS..........
  107. vector    look1                                          local
  108. vector    indyTargPos                                      local
  109.  
  110.  
  111. vector    pierstart                                      local
  112. vector    pierend                                          local
  113. vector    boatstart                                      local
  114. vector    boatend                                          local
  115.  
  116.  
  117. #............TEMPLATES..........
  118.  
  119. template    ring=+ripples                            local
  120. template    ghostTpl=ghost                            local
  121.  
  122. #............KEYFRAMES..........
  123. keyframe    inReach=in_activate_medium.key            local
  124. keyframe    inGrab=in_activate_low.key                local
  125.  
  126.  
  127. #............SOUNDS..........
  128. sound    ancientdevice=nub_aethdoorarm_start_c.wav    local
  129. sound    waterrush=nub_bull_move2_c.wav                local
  130. sound    scorpdoor=nub_stonedoor_stop_c.wav            local
  131. sound    in_akey=INXJ168.WAV    local                    local
  132. sound    in_whathavewe=INXJ005.WAV                    local
  133. sound    huge_groan=nub_bull_move4_c.wav                local
  134. sound    stonedoor=olv_quetzdoor_move_c.wav            local
  135. sound    awe_cue=mus_gen_awesome1.wav                local
  136. end
  137.  
  138. # ========================================================================================
  139.  
  140. code
  141.  
  142. startup:
  143.  
  144.     Sleep(0.5);
  145.     
  146.     player = GetLocalPlayerThing();
  147.  
  148.     AttachThingToThingEx(key, boat, 0x000C);
  149.     AttachThingToThingEx(theKing, boat, 0x000C);
  150.     
  151.     # scorpions will not respond to AI
  152.     AISetCutSceneMode(scorp1);
  153.     AISetCutSceneMode(scorp2);
  154.     
  155.  
  156.     # hide the sharks
  157.     SetThingFlags(shark1, 0x80000);
  158.     SetThingFlags(shark2, 0x80000);
  159.  
  160.     pierstart    = VectorSet(0.2, 0.2, 1.0);
  161.     pierend    = VectorSet(0.4, 0.4, 0.0);
  162.     boatstart    = VectorSet(0.5, 0.5, 1.0);
  163.     boatend    = VectorSet(0.8, 0.8, 0.0);
  164.  
  165.     # doorfloorSURF is a move adjoin
  166.     SetAdjoinFlags(doorfloorSURF, 2);
  167.     SetAdjoinFlags(GetSurfaceAdjoin(doorfloorSURF), 2);
  168.     
  169.     return;
  170.  
  171. # ========================================================================================
  172.  
  173. activated:
  174.  
  175.     If ((GetSenderRef() == switch) && (released == 0))    #player hits button in control room
  176.         {
  177.             StartCutScene(1);
  178.             SetActorFlags(player, 0x200000);
  179.             released = 1;
  180.             # prep camera
  181.             curCam = GetCurrentCamera();
  182.             # offset camera to a known thing
  183.             DeselectWeaponWait(player);
  184.             SetExtCamOffsetToThing(cam1);
  185.             CopyPlayerHolsters(player, indy); # make sure actor has matching props
  186.             CopyOrientAndPos(player, indy);
  187.             SetThingFlags(player, 0x80000);
  188.             ClearThingFlags(indy, 0x80000);
  189.             
  190.             # set doc to no collide
  191.             SetCollideType(doc, 0);
  192.             
  193.             # Line Indy up...
  194.             AISetLookThingEyeLevel(indy, switch);
  195.             AIWaitForStop(indy);
  196.  
  197.             # create a target right above and in front of indy actor
  198.             indyTargPos = VectorAdd(VectorTransformToOrient(indy, '0.0 0.02 0.02'), GetThingPos(indy));
  199.             indytarget = CreateThingAtPos(ghostTpl, GetThingSector(indy), indyTargPos, '0 0 0');
  200.             CaptureThing(indytarget);
  201.  
  202.             Sleep(0.25);
  203.             PlayKey(indy, inReach, 4, 0x12, 0);
  204.             Sleep(0.25);
  205.             MovetoFrame(switch, 1, .35);
  206.             Sleep(1.0);
  207.             # get camera 2 to be where the offset is
  208.             SetCameraFocus(2, cam1);
  209.             SetCameraSecondaryFocus(2, indytarget);
  210.             SetCameraLookInterp(2,0);
  211.             Sleep(.25);
  212.             SetCurrentCamera(2);
  213.             SetCameraFOV(90, 0, 0);
  214.             # ancient machinery sound fx...
  215.             PlaySoundLocal(ancientdevice, 1.0, 0, 0x0, 0);
  216.             
  217.             # move the indytarget out to the boat's position
  218.             animId = MoveThingToPos(indytarget, GetThingPos(boat), 3.0);
  219.             Sleep(.5);
  220.             
  221.             # focus camera on the boat and move it out for a better view
  222.             MovetoFrame(cam1, 1, 3.0);
  223.             WaitforStop(cam1);
  224.             SetCameraSecondaryFocus(2, boat);
  225.             
  226.             # camera interp disabled
  227.             SetCameraLookInterp(2, 0);
  228.             DestroyThing(indytarget);
  229.             
  230.             Sleep(.25);
  231.             SetPulse(.1);        # screenshake and ring sprite generation handled on pulse messages
  232.             
  233.             # begin movements...
  234.             MovetoFrame(piers, 1, .5);
  235.             MovetoFrame(boat, 1, .5);
  236.             soundrun = PlaySoundLocal(waterrush, 1, 1, 0x01, 0);
  237.             music=PlaySoundLocal(awe_cue, 1, 1, 0x0, 0);
  238.         }
  239.  
  240. If ((GetSenderRef() == key) && (keysaid == 0))
  241.     {
  242.         keysaid = 1;
  243.         # offset the camera to a standard grab pos
  244.         look1=VectorSet(-0.2, 0.0, 0.2);
  245.         SetExtCamOffset(look1);
  246.         
  247.         # indy says "what have we here..."
  248.         PlayVoice(player, in_whathavewe, 1, 0);
  249.         
  250.         # skip a beat
  251.         Sleep(0.5);
  252.         PlayKey(player, inGrab, 4, 0x12, 0);
  253.         Sleep(1.0);
  254.         DestroyThing(key);
  255.         # add the key to Jone's inventory
  256.         ChangeInv(player, 116, 1);
  257.         SetInvAvailable(player, 116, 1);
  258.         JonesInvItemChanged(116);
  259.  
  260.         # indy says "a key..."
  261.         PlayVoice(player, in_akey, 1, 0);
  262.         
  263.         # restore the camera
  264.         RestoreExtCam();
  265.  
  266.         # restore the player
  267.         ClearActorFlags(player, 0x200000);
  268.  
  269.         SendMessage(hintcog, user0);
  270.     }
  271.  
  272. return;
  273.         
  274.         
  275. # ========================================================================================
  276.  
  277. arrived:
  278.  
  279.     If ((GetSenderRef() == piers) && (GetCurFrame(piers) == 1))
  280.         {
  281.             StopSound(soundrun, 4.0);
  282.             SetPulse(0);
  283.         }
  284.     
  285.     If ((GetSenderRef() == boat) && (GetCurFrame(boat) == 1))
  286.         {
  287.             MovetoFrame(boat, 2, .25);
  288.             for (i = 0; i <= 5; i = i + 1) 
  289.                 {
  290.                     boatring = CreateThing(ring, boatringpos);
  291.                     AnimateSpriteSize(boatring, boatstart, boatend, 1.5);
  292.                     sleep(.5);
  293.                 }
  294.         }
  295.     
  296.     If ((GetSenderRef() == boat) && (GetCurFrame(boat) == 2))
  297.         {
  298.             # secondary pier sound effect
  299.             PlaySoundLocal(scorpdoor, 0.1, 1, 0x0, 0);
  300.             
  301.             # attach the ripple object to the boat
  302.             AttachThingToThing(boatringpos, boat);
  303.             SetTimerEx(0.5, TIMERID_RIPPLES, 0, 0);        # timer will create ripples at the boats' position until it is stopped
  304.             MovetoFrame(boat, 12, 1.5);
  305.             Sleep(6.0);            # wait for boat to go around the corner
  306.             
  307.             # switch to shark grill cam
  308.             SetCameraSecondaryFocus(2, sharkCamtarget);
  309.             SetCameraFocus(2, sharkCam);
  310.             Sleep(0.5);
  311.             SetPulse(0.1);
  312.             MoveToFrame(shark_bars, 1, 1.0);
  313.             WaitForStop(shark_bars);
  314.             SetPulse(0.0);
  315.             Sleep(0.5);
  316.             
  317.             # switch to door cam
  318.             SetCameraLookInterp(2,0);
  319.             SetCameraSecondaryFocus(2, scorplooktarget);
  320.             SetCameraFocus(2, cam2);
  321.             MoveToFrame(cam2, 1, 0.5);
  322.             MovetoFrame(door, 1, 4);
  323.             doorloop=PlaySoundLocal(stonedoor, 0.5, -1, 0x1, 0);
  324.             WaitForStop(door);
  325.             StopSound(doorloop, 0);
  326.             PlaySoundLocal(scorpdoor, 0.5, -1, 0x0, 0);
  327.             Sleep(0.25);
  328.  
  329.             # doorfloorSURF becomes no move adjoin
  330.             ClearAdjoinFlags(doorfloorSURF, 2);
  331.             ClearAdjoinFlags(GetSurfaceAdjoin(doorfloorSURF), 2);
  332.             
  333.             # scorpians rush in
  334.             AISetMoveSpeed(scorp1, 1.0);
  335.             AISetMoveThing(scorp1, scorp1_mv0, 0);
  336.             AISetMoveSpeed(scorp2, 1.0);
  337.             AISetMoveThing(scorp2, scorp2_mv0, 0);
  338.             
  339.             Sleep(1.5);
  340.             SetCurrentCamera(curCam);
  341.             ResetCameraFOV(0, 0.0);
  342.             RestoreExtCam();
  343.             SetThingFlags(indy, 0x80000);
  344.             ClearThingFlags(player, 0x80000);
  345.             ClearActorFlags(player, 0x200000);
  346.             ClearThingFlags(shark1, 0x80000);
  347.             SendMessageEx(SharkWaycog, user0, t_shark00, 0, 0, 0);
  348.             ClearThingFlags(shark2, 0x80000);
  349.             SendMessageEx(SharkWaycog, user0, t_shark01, 0, 0, 0);
  350.  
  351.             EndCutScene();
  352.             AICLearCutSceneMode(scorp1);
  353.             AICLearCutSceneMode(scorp2);
  354.         
  355.             # restore doc collision
  356.             SetCollideType(doc, 3);
  357.  
  358.     
  359.         }
  360.  
  361.      If ((GetSenderRef() == boat) && (GetCurFrame(boat) == 4))    # fade the music level down
  362.             {
  363.                 ChangeSoundVol(music, .5, 5);
  364.             }        
  365.  
  366.     
  367.     If ((GetSenderRef() == boat) && (GetCurFrame(boat) == 12))
  368.             {
  369.                 DetachThing(key);
  370.             }    
  371.     
  372.     return;
  373.  
  374.  
  375. # ========================================================================================
  376.  
  377. pulse:
  378.  
  379.     SetPOVShake('0.0 0.0 0.007', '0.0 0.0 0.00', 80.0, 0.80);
  380.     index=index+1;
  381.     
  382.     If (index == 3)
  383.     {
  384.     pierring1 = CreateThing(ring, pierring1pos);
  385.     AnimateSpriteSize(pierring1, pierstart, pierend, 1.5);
  386.     
  387.     pierring2 = CreateThing(ring, pierring2pos);
  388.     AnimateSpriteSize(pierring2, pierstart, pierend, 1.5);
  389.     
  390.     pierring3 = CreateThing(ring, pierring3pos);
  391.     AnimateSpriteSize(pierring3, pierstart, pierend, 1.5);
  392.     
  393.     pierring4 = CreateThing(ring, pierring4pos);
  394.     AnimateSpriteSize(pierring4, pierstart, pierend, 1.5);
  395.     index=0;
  396.     }
  397.     
  398.     return;
  399.     
  400.  
  401. # ========================================================================================
  402. entered:
  403.  
  404. If ((GetSenderRef() == exit_sect) && (GetSourceRef() == player))
  405.     {
  406.         KillTimerEx(TIMERID_RIPPLES);
  407.     }
  408.  
  409. return;
  410. # ========================================================================================
  411. timer:
  412.         # water rings at the base of the boat
  413.         boatring = CreateThing(ring, boatringpos);
  414.         AnimateSpriteSize(boatring, boatstart, boatend, 1.5);
  415.         SetTimerEx(0.4, TIMERID_RIPPLES, 0, 0);
  416.         return;
  417.  
  418. # ========================================================================================
  419. end
  420.  
  421.  
  422.  
  423.  
  424.